package com.zhb.cms.domain.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import com.zhb.cms.domain.dao.UrUserLoginInfoMapper;
import com.zhb.cms.domain.dao.UrUserOrgMenuInfoMapper;
import com.zhb.cms.domain.dao.UrUserOrgPortalInfoMapper;
import com.zhb.cms.domain.vo.UserOrgMenusVO;
import com.zhb.cms.domain.vo.UserOrgPortalVO;
import com.zhb.cms.domain.vo.UserTokenVO;
import com.zhb.cms.sdk.bean.Result;

@Service("userOrgMenuService")
public class UserOrgMenuService {

	@Autowired
	private UrUserOrgMenuInfoMapper urUserOrgMenuInfoMapper;
    /**
     * 
    * @Title: searchOrgMenus 
    * @Description: 查询用户的机构菜单信息列表 
    * @author  张海滨  zhanghb22 
    * @date 2017年12月12日 下午2:05:37 
    * @return Result<List<UserOrgMenusVO>>    返回类型
     */
	public Result<List<UserOrgMenusVO>> searchOrgMenus(String userCd,String orgCd,String portalCd){
		List<UserOrgMenusVO> userOrgMenusVOList=urUserOrgMenuInfoMapper.searchOrgfirstMenus(userCd, orgCd, portalCd);
		if(userOrgMenusVOList.size()>0)
		{
			for(UserOrgMenusVO userOrgMenuVO:userOrgMenusVOList){
				userOrgMenuVO.setChildren(urUserOrgMenuInfoMapper.searchOrgsecondMenus(userCd, orgCd, userOrgMenuVO.getCode()));
			}
		}
				
		return new Result<List<UserOrgMenusVO>>("0",null,userOrgMenusVOList);
	}
}
